package com.jdk.demo.inputStreamReader;

import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.InputStreamReader;
import java.io.OutputStreamWriter;

public class Test {

	public static void main(String[] args) throws Exception {
		InputStreamReader isr = new InputStreamReader(new FileInputStream("E:/zsl/temp2.txt"), "UTF-8");

		// 读取数据
		// 一次读取一个字符
		int ch = 0;
		while ((ch = isr.read()) != -1) {
			// System.out.print((char) ch);
		}

		// 释放资源
		isr.close();

		InputStreamReader isr2 = new InputStreamReader(new FileInputStream("E:/zsl/temp2.txt"), "UTF-8");
		OutputStreamWriter osw = new OutputStreamWriter(new FileOutputStream("E:/zsl/temp3.txt"), "UTF-8");

		// 读取数据
		// 一次读取一个字符
		char[] chs = new char[1024];
		while ((ch = isr2.read(chs)) != -1) {
			osw.write(chs, 0, ch);
			osw.flush();
		}

		// 释放资源
		isr2.close();
		osw.close();
	}

}